'''
Descripttion: 
Author: equipment copyWhite
Date: 2024-12-30 11:38:12
LastEditTime: 2025-01-09 15:52:26
'''
from db import db


class Record(db.Model):
    __tablename__ = 'tb_record'
    id = db.Column(db.String(255), primary_key=True)
    user_id = db.Column(db.String(255), db.ForeignKey('tb_user.id'), nullable=False)
    equipment_id = db.Column(db.String(255), db.ForeignKey('tb_equipment.equipment_id'), nullable=False)
    creat_time = db.Column(db.String(255))
    type = db.Column(db.String(255))
    effect = db.Column(db.String(255))


    def __init__(self, id, user_id, equipment_id, creat_time, type, effect,):
        self.id = id
        self.user_id = user_id
        self.equipment_id = equipment_id
        self.creat_time = creat_time
        self.type = type
        self.effect = effect

    def get(self):
        return {
            "id": self.id,
            "user_id": self.user_id,
            "equipment_id": self.equipment_id,
            "creat_time": self.creat_time,
            "type": self.type,
            "effect": self.effect           
        }
        

    def __repr__(self):
        return f'<Record {self.id}>'